package fr.ralmn.OgameDroid;

import java.util.List;
import java.util.Vector;

import android.app.ActionBar;
import android.os.Bundle;
import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentActivity;
import android.support.v4.view.ViewPager;
import android.util.Log;
import fr.ralmn.OgameDroid.Frame.Ressource_Batiments;
import fr.ralmn.OgameDroid.Frame.Ressource_Info;
import fr.ralmn.OgameDroid.Frame.Ressource_ressources;
import fr.ralmn.OgameDroid.Frame.Ressource_techno;
import fr.ralmn.OgameDroid.Object.Batiment;
import fr.ralmn.OgameDroid.Object.Objects;
import fr.ralmn.OgameDroid.Object.Technologie;
import fr.ralmn.OgameDroid.list.Adapter.TabsAdapter;

public class RessourceActivity extends FragmentActivity {

	public static Batiment technologie = Objects.metal;
	private TabsAdapter mTabsAdapter;
	private int LEVEL = 1;

	@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setContentView(R.layout.viewpager_techno);

		List<Fragment> fragements = new Vector();
		technologie = Util.getBatiment(getIntent().getExtras().getString(
				"technologie"));
		Bundle t = new Bundle();
		t.putString("technologie", technologie.getName());
		Log.d("RALMN", technologie.getName() + " -----");
		ViewPager pager = (ViewPager) findViewById(R.id.viewpager_techno);
		final ActionBar bar = getActionBar();
		bar.setNavigationMode(ActionBar.NAVIGATION_MODE_TABS);
		bar.setDisplayOptions(0, ActionBar.DISPLAY_SHOW_TITLE);
		bar.setHomeButtonEnabled(true);
		bar.setDisplayShowHomeEnabled(true);
		mTabsAdapter = new TabsAdapter(this, pager, getSupportFragmentManager());
		mTabsAdapter.addTab(bar.newTab().setText("Info"), Ressource_Info.class, t);
		mTabsAdapter.addTab(bar.newTab().setText("Ressources"),
				Ressource_ressources.class, t);

		if (!technologie.getRequire().getBatiments().isEmpty()
				&& technologie.getRequire().getBatiments() != null)
			mTabsAdapter.addTab(bar.newTab().setText("Batiments nessaire"),
					Ressource_Batiments.class, t);
		if (!technologie.getRequire().getTechnos().isEmpty()
				&& technologie.getRequire().getTechnos() != null)
			mTabsAdapter.addTab(bar.newTab().setText("Technologies nessaire"),
					Ressource_techno.class, t);

	}

}
